<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/layui/layui.js"></script>
    <link rel="stylesheet" href="lib/layui/css/layui.css">
</head>
<body>
<table id="demo" lay-filter="test"></table>
<script>
    layui.use('table', function(){
        var table = layui.table;

        //第一个实例
        table.render({
            elem: '#demo'
            ,url: '../getRooms' //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'id', title: 'ID',  sort: true, fixed: 'left'}
                ,{field: 'department_id', title: '诊室编号',templet:function (d){return d.department.name}}
                ,{field: 'name', title: '诊室名称',sort: true}
                ,{field: 'created_time', title: '创建时间'}
                ,{field: 'updated_time', title: '修改时间'}
            ]]
        });

    });
</script>
</body>
</html>
</body>
</html>
